package com.training.java.core.collections.car.pre15;

/**
 * Collections The purpose of this class is to observe how the equals compare 2
 * strings. How instanceof is checking runtime objects. instanceof will check
 * the parameter that we are passing to obj is real time object or not.
 * 
 */

public class Car1 {

	private String vinNumber;
	private String make;
	private String model;

	// Getter and Setters

	public String getVinNumber() {
		return vinNumber;
	}

	public void setVinNumber(String vinNumber) {
		this.vinNumber = vinNumber;
	}

	public String getMake() {
		return make;
	}

	public void setMake(String make) {
		this.make = make;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	// Creating the constructor
	public Car1(String vinNumber, String make, String model)

	{
		this.vinNumber = vinNumber;
		this.make = make;
		this.model = model;
	}

	public Car1() {

	}

	// Here the requirement is "If vinNumbers are equal the cars are equal"

	/*
	 * @Override public boolean equals(Object obj) {
	 * 
	 * // checking the parameter is real time object Car or not. // if it is
	 * other than real time Car (String ie "Satya") it should // return False.
	 * 
	 * if (obj instanceof Car1)
	 * 
	 * { Car1 that = (Car1) obj; // Casting return
	 * this.vinNumber.equals(that.vinNumber);
	 * 
	 * } else { return false;
	 * 
	 * }
	 * 
	 * }//end of equals method
	 * 
	 * //Overriding the hashCode
	 * 
	 * @Override
	 * 
	 * public int hashCode() { return
	 * vinNumber.hashCode()+make.hashCode()+model.hashCode(); }
	 */

}
